package iddscui;

import Main.Parameters;
import plugin.SystemInterface;

/**
 * IDDS - Ice Dragon Delivery System Copyright 2009 ZeM
 * iddsCUI - is a Ice Dragon Delivery System Console User Interface
 * @author ZeM
 */
public class iddsCUI implements SystemInterface {

    Thread console_run;

    public void start() {

        int k = 0;
        boolean found = false;
        while (!found) {
            if (Parameters.RunningLibs[k].equals("iddsCUI")) {
                found = true;
            } else {
                k++;
            }
        }

        Parameters.LibConsoleInputReceiver = k;
        
    }

    public void interrupt() {
        try {

            console_run.interrupt();

        } catch (Exception error) {
        }

    }

    public void input(String message) {
        iddsCUIrun p = new iddsCUIrun();
        p.inp = message;
        console_run = new Thread(p);
        console_run.start();
    }

    public void pause() {
        try {

            console_run.wait();
        } catch (Exception error) {
        }
    }

    public void play() {

        console_run.notify();

    }
}
